﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace _13键盘事件
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        
        private void KeyEvent(object sender, KeyEventArgs e)
        {
            string eventStr = "sender:" + sender.ToString() + "\r\n"
                            + "Source:" + e.Source + "\r\n"
                            + "Original Source:" + e.OriginalSource + "\r\n"
                            + "Event:" + e.RoutedEvent;
            lstMsg.Items.Add(eventStr);
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            lstMsg.Items.Clear();
        }

        private void extInput(object sender, TextCompositionEventArgs e)
        {
            string eventStr = "sender:" + sender.ToString() + "\r\n"
                            + "Source:" + e.Source + "\r\n"
                            + "Original Source:" + e.OriginalSource + "\r\n"
                            + "Event:" + e.RoutedEvent;
            lstMsg.Items.Add(eventStr);
        }
    }
}
